$(document).ready(function(){
	$("#getCode").click(function(){
		 $(this).unbind("click");
		timedCount();
		Regist.getCode();
	});
});
var c= 60;
var t;
var CommonPara ='"deviceId":"08e89529b04c4c0dd27191c482565f7629542700","deviceOs":"iOS","deviceOsversion":"8.1","deviceType":"iPhone Simulator","appVersion":"4.5.0","appChannelNo":"0"';
function timedCount(){
    document.getElementById("getCode").innerHTML = c;
    c= c-1;
    if(c === 0){
        document.getElementById("getCode").innerHTML = "获取验证码";
        $("#getCode").removeAttr("disabled");
        $("getCode").bind("click");
//      $("#getCode").css("background","#337bbf");
        c = 60;
        return 0 ;
    }
    t= setTimeout("timedCount()",1000);
    //alert(t)
}

var Regist = $.extend({
	Registing:function(){
//		var RealName = $("#realName").val();
		var NickName = $("#nickName").val();
		var Ph_num = $("#ph-num").val();
		var Code = $("#code").val();
		var infomap ='{"phone":"'+Ph_num+'","nickname":"'+NickName+'","phoneCheckCode":"'+Code+'","password":"888888",'+CommonPara+'}';
        var postinfo ="2014"+infomap+"YunzoCOC";
        var mw = $.md5(postinfo);//md5����
        var chArt = $.stringtoArray(mw);//KL��������
        var t= base64encode(chArt);//
        var Post ="cocSign="+t+"&infoMap="+encodeURIComponent(infomap);		
		$.ajax({
			url:'/cocmore-web/mobileapi/user/regUser',
			type:'post',
			data:Post,
			success:function(){
				
			}
		});
	},
	getCode:function(){
		var Ph_num = $("#ph-num").val();
		var infomap ='{"phone":"'+Ph_num+'",'+CommonPara+'}';
        var postinfo ="2014"+infomap+"YunzoCOC";
        var mw = $.md5(postinfo);//md5����
        var chArt = $.stringtoArray(mw);//KL��������
        var t= base64encode(chArt);//
        var Post ="cocSign="+t+"&infoMap="+encodeURIComponent(infomap);
		$.ajax({
			url:'/cocmore-web/mobileapi/user/getPhoneRegSMSCode',
			type:'post',
			data:Post,
			success:function(msg){
				
			}
		});
	}
});